<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>xeokit Example</title>
    <link href="../css/pageStyle.css" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
</head>
<body>
<input type="checkbox" id="info-button"/>
<label for="info-button" class="info-button"><i class="far fa-3x fa-question-circle"></i></label>
<canvas id="myCanvas"></canvas>
<div class="slideout-sidebar">
    <img class="info-icon" src="../../assets/images/gltf_logo.png"/>
    <h1>GLTFLoaderPlugin</h1>
    <p>Loading a glTF Model positioned far from the origin, which therefore relies on xeokit's double-precision coordinates support.</p>
    <h3>Components used</h3>
    <ul>
        <li>
            <a href="../../docs/class/src/viewer/Viewer.js~Viewer.html"
               target="_other">Viewer</a>
        </li>
        <li>
            <a href="../../docs/class/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin.html"
               target="_other">GLTFLoaderPlugin</a>
        </li>
    </ul>
    <h3>Assets</h3>
    <ul>
        <li>Model center is [1842022, 10, -5173301]</li>
        <li>Model provided by <a href="https://bimdata.io" target="_other">BIMData.io</a></li>
    </ul>
</div>
</body>
<script type="module">

    import {Viewer, GLTFLoaderPlugin} from "../../dist/xeokit-sdk.min.es.js";

    const viewer = new Viewer({
        canvasId: "myCanvas",
        transparent: true,
        logarithmicDepthEnabled: true
    });

    viewer.scene.camera.eye = [1841982.5187600704, 19.207790938410042, -5173303.042326414];
    viewer.scene.camera.look = [1842011.793756829, 9.913817421536704, -5173299.841616623];
    viewer.scene.camera.up = [0.2991762376746394, 0.9536370664170352, 0.0327096983532173];

    viewer.camera.perspective.near = 1.0;
    viewer.camera.perspective.far = 10000000; // 10000km

    viewer.camera.ortho.near = 1.0;
    viewer.camera.ortho.far = 10000000; // 10000km

    const gltfLoader = new GLTFLoaderPlugin(viewer);

    const sceneModel = gltfLoader.load({
        id: "myModel",
        src: "../../assets/models/gltf/MAP/glTF-Embedded/MAP.gltf",
        metaModelSrc: "../../assets/models/gltf/MAP/MAP.json",
        edges: true
    });

    sceneModel.on("loaded", () => {
        viewer.cameraFlight.flyTo(sceneModel);
    });

</script>
</html>